using System;
using SubversionReports.Utilities;

namespace SubversionReports.Web
{
    public partial class RepositoryBrowser : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            PageFunction pageFunction;
            if (!SvnWebDav.AuthenticationSuceeded)
                pageFunction = PageFunction.RepositoryLogin;
            else if (!string.IsNullOrEmpty(Request["ChangeLog"]))
                pageFunction = PageFunction.ChangeLog;
            else if (!string.IsNullOrEmpty(Request["RevisionId"]))
                pageFunction = PageFunction.PathsView;
            else if (!string.IsNullOrEmpty(Request["Path"]))
                pageFunction = PageFunction.FolderView;
            else
                pageFunction = PageFunction.RevisionsView;

            RepositoryLogin1.Visible = pageFunction.Equals(PageFunction.RepositoryLogin);
            PathsView1.Visible = pageFunction.Equals(PageFunction.PathsView);
            RevisionsView1.Visible = pageFunction.Equals(PageFunction.RevisionsView);
            FolderView1.Visible = pageFunction.Equals(PageFunction.FolderView);
            ChangeLog1.Visible = pageFunction.Equals(PageFunction.ChangeLog);
        }

        enum PageFunction
        {
            RepositoryLogin,
            RevisionsView,
            PathsView,
            FolderView,
            ChangeLog
        }
    }
}
